<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_address.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<%@page import="java.util.*" %>
<html>
  <head>
    
    <title>会员收货地址管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_areaInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_categoryInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>	
	<script type="text/javascript" src="js_area.js"></script>
	<script type="text/javascript" src="index.js"></script>
</head>

<body>

  <% 
  	String addr_id="";
  	if(request.getParameter("addr_id")!=null) addr_id = request.getParameter("addr_id");
	Ti_addressInfo ti_addressInfo = new Ti_addressInfo();
  	List list = ti_addressInfo.getListByPk(addr_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String cust_id="",consignee="",level_no="",email="",area_attr="",address="",post_code="",tel="",cellphone="",best_time="",in_date="",user_id="",remark="";
  	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	if(map.get("consignee")!=null) consignee = map.get("consignee").toString();
  	if(map.get("level_no")!=null) level_no = map.get("level_no").toString();
  	if(map.get("email")!=null) email = map.get("email").toString();
  	if(map.get("area_attr")!=null) area_attr = map.get("area_attr").toString();
  	if(map.get("address")!=null) address = map.get("address").toString();
  	if(map.get("post_code")!=null) post_code = map.get("post_code").toString();
  	if(map.get("tel")!=null) tel = map.get("tel").toString();
  	if(map.get("cellphone")!=null) cellphone = map.get("cellphone").toString();
  	if(map.get("best_time")!=null) best_time = map.get("best_time").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("remark")!=null) remark = map.get("remark").toString();
	
	Ts_areaInfo areaBean = new Ts_areaInfo(); 	
  	
	   String areaAttr = "";			
		if (map.get("area_attr") != null) {
		area_attr = map.get("area_attr").toString();
		String areaArr[] = area_attr.split("\\|");
		for( int k = 0; k < areaArr.length; k++ ){
			areaAttr = areaAttr + " &nbsp; " + areaBean.getAreaNameById( areaArr[k]);
		}
	}	

  %>
	
	<h1>修改会员收货地址</h1>
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	
	
	<form action="/doTradeReg.do" method="post" name="addForm">
	<input name="addr_id" id="addr_id" value="<%=addr_id %>" type="hidden" />
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
	
		<tr>
		<td align="right" width="10%">
			收货人姓名<font color="red">*</font>
		</td>
		<td><input name="consignee" id="consignee" size="20" maxlength="20" value="<%=consignee %>" type="text" /></td>
		<td align="right" width="10%">
				优先级<font color="red">*</font>
			</td>
			<td><input name="level_no" id="level_no" size="" maxlength="" value="<%=level_no %>" type="text" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='0'"/>（只能为数字）</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				邮箱<font color="red">*</font>
			</td>
			<td><input name="email" id="email" size="" maxlength="" value="<%=email %>" type="text" /></td>
		<td width="12%" align="right">地区:<font color="red">*</font></td>
		<td width="60%">
			<div id="org1">
					<font color="#CECECE"><%=areaAttr%></font>
					<input type="button" name="buttons" value="修改地区" class="buttoncss" onclick="ChangeOrg()" />
				</div>
				<div style="display:none;" id="org2">
					<select name="province" id="province" onclick="setCitys(this.value)">
					  <option value="">省份</option> 
					</select>
					<select name="eparchy_code" id="eparchy_code" onclick="setAreas(this.value)">
					  <option value="">地级市</option> 
					 </select>
					<select name="city_code" id="city_code" style="display:inline" >
					 <option value="">市、县级市、县</option> 
					</select>
				</div>
				
					<input type="hidden" name="area_attr" id="area_attr" value="<%=area_attr%>" /></tr>
		 </td>
		
		<tr>
			<td align="right" width="10%">
				详细地址:
			</td>
			<td colspan="3"><input name="address" id="address" size="50" maxlength="50" value="<%=address %>" type="text" onBlur="this.value=trim(this.value);" /></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				邮编:
			</td>
			<td><input name="post_code" id="post_code" size="20" maxlength="10" value="<%=post_code %>" type="text" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>
		<td align="right" width="10%">
				电话:
			</td>
			<td><input name="tel" id="tel" size="20" maxlength="20" value="<%=tel %>" type="text" onKeyUp="if(!/^(\d|_)+$/.test(this.value))this.value=''"/></td>
		</tr>
		
		
		<tr>
			<td align="right" width="10%">
				手机<font color="red">*</font>
			</td>
			<td><input name="cellphone" id="cellphone" size="20" maxlength="20" value="<%=cellphone %>" type="text" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''"/></td>
		<td align="right" width="10%">
				最佳送货时间:
			</td>
			<td><select id="best_time" name="best_time">
			<option value="1" <%if(best_time.equals("0")) out.print("selected");%>>不限</option>
			<option value="2"  <%if(best_time.equals("2")) out.print("selected");%>>周一至周五</option>
			<option value="3"  <%if(best_time.equals("1")) out.print("selected");%>>周末</option>
			</select>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				备注:
			</td>
			<td colspan="3"><input name="remark" id="remark" size="50" maxlength="50" value="<%=remark %>" type="text" onBlur="this.value=trim(this.value);" /></td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="bpm_id" value="2575" />
				<input name="user_id"  value="<%=user_id %>" type="hidden" />
	  			<input type="hidden" name="addr_id" value="<%=addr_id %>" />
				<input type="submit" class="buttoncss" name="tradeSub" value="提交" onclick="return checkSub();"/>&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
